package com.bc.bcmodel.req;

import com.bc.bcmodel.domain.T_User_buyer_infoModel;
import com.bc.commoncore.security.DES;
import com.bc.commoncore.util.DataUtils;
import com.bc.commoncore.util.DateUtil;
import com.bc.commoncore.util.Digest;
import com.bc.commoncore.util.StringUtils;
import com.bc.commonentity.enums.HttpReturnRnums;

public class UserBuyerSignUpReq extends UserSignUpReq {
    private String country;//国家
    private String address;//常住地址
    private String img_address;//常住地址截图说明
    private String passport_code;//护照号码
    private String head_figure;//头图
    private String img_passport_after;//护照反面
    private String img_passport_front;//护照正面
    private String img_passport_hold;//手持护照
    private String memo;//备注
    private String nick_name;//昵称
    private String true_name;//姓名

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getImg_address() {
        return img_address;
    }

    public void setImg_address(String img_address) {
        this.img_address = img_address;
    }

    public String getPassport_code() {
        return passport_code;
    }

    public void setPassport_code(String passport_code) {
        this.passport_code = passport_code;
    }

    public String getHead_figure() {
        return head_figure;
    }

    public void setHead_figure(String head_figure) {
        this.head_figure = head_figure;
    }

    public String getImg_passport_after() {
        return img_passport_after;
    }

    public void setImg_passport_after(String img_passport_after) {
        this.img_passport_after = img_passport_after;
    }

    public String getImg_passport_front() {
        return img_passport_front;
    }

    public void setImg_passport_front(String img_passport_front) {
        this.img_passport_front = img_passport_front;
    }

    public String getImg_passport_hold() {
        return img_passport_hold;
    }

    public void setImg_passport_hold(String img_passport_hold) {
        this.img_passport_hold = img_passport_hold;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getNick_name() {
        return nick_name;
    }

    public void setNick_name(String nick_name) {
        this.nick_name = nick_name;
    }

    public String getTrue_name() {
        return true_name;
    }

    public void setTrue_name(String true_name) {
        this.true_name = true_name;
    }

    public HttpReturnRnums paramsCheck() {
        if (!DataUtils.isEmail(getEmail())) {
            return HttpReturnRnums.ParaError;
        }
        if (StringUtils.isEmpty(getPassWd())) {
            return HttpReturnRnums.PASSWD_IS_EMPTY;
        }

        return HttpReturnRnums.Success;
    }

    public T_User_buyer_infoModel convertorUser(String userId) {
        T_User_buyer_infoModel model = new T_User_buyer_infoModel();
        model.setEmail(getEmail());
        model.setMemo(org.apache.commons.lang.StringUtils.EMPTY);
        model.setCreate_time(DateUtil.getToday());
        model.setHead_figure(org.apache.commons.lang.StringUtils.EMPTY);
        model.setModify_time(DateUtil.getToday());
        model.setNick_name(StringUtils.EMPTY);
        model.setPassword(Digest.signMD5(getPassWd(), Digest.ENCODE));
        model.setStatus("0");
        model.setUser_id(userId);
        model.setRequest_from("websit");
        String code = StringUtils.trim(getInviteCode());
        if (!StringUtils.isEmpty(code)) {
            try {
                code = DES.decrypt(code);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        model.setInvite_code(code);
        model.setCountry(StringUtils.trim(getCountry()));
        model.setAddress(StringUtils.trim(getAddress()));
        model.setImg_address(StringUtils.trim(getImg_address()));
        model.setHead_figure(StringUtils.trim(getHead_figure()));
        model.setPassport_code(StringUtils.trim(getPassport_code()));
        model.setImg_passport_after(StringUtils.trim(getImg_passport_after()));
        model.setImg_passport_front(StringUtils.trim(getImg_passport_front()));
        model.setImg_passport_hold(StringUtils.trim(getImg_passport_hold()));
        model.setMemo(StringUtils.trim(getMemo()));
        model.setNick_name(StringUtils.trim(getNick_name()));
        model.setTrue_name(StringUtils.trim(getTrue_name()));
        model.setIntegral(0);
        return model;
    }
}
